use poem_openapi::{payload::Json, Tags, ApiResponse, Object};


#[derive(Tags)]
pub enum ApiTags {
    /// 获取打卡信息接口的入参格式
    ClockInfoRequest,
}

/// 创建打卡入参模式
#[derive(Debug, Object, Clone, Eq, PartialEq)]
pub struct ClockInfoRequest {

    /// 用户编号
    #[oai(max_length = 64)]
    pub user_code: Option<String>,

    /// 考勤时间
    #[oai(max_length = 64)]
    pub attendance_time: Option<String>,  

}

#[derive(Debug, Object, Clone, PartialEq)]
pub struct ClockInfo {
    /// 考勤组ID
    #[oai(max_length = 64)]
    pub group_id: String,

    /// 考勤组名称
    #[oai(max_length = 64)]
    pub group_name: String,

    /// 当前班次
    #[oai(max_length = 64)]
    pub frequency_id: String,

    /// user_id
    #[oai(max_length = 64)]
    pub user_id: String,

    /// user_code
    #[oai(max_length = 64)]
    pub user_code: String,

    /// user_name
    #[oai(max_length = 64)]
    pub user_name: String,

    /// 经度
    #[oai()]
    pub longitude: f64,

    /// 纬度
    #[oai()]
    pub latitude: f64,

    /// 打卡地点
    #[oai(max_length = 256)]
    pub address: Option<String>,

    /// 打卡类型
    /// - 1: 正常打卡 
    /// - 2: 外勤打卡
    /// - 3: 补卡
    #[oai(maximum(value = "9"))]
    pub clockin_type: u8,

    /// 打卡标识
    /// - 1: 上班打卡 
    /// - 2: 下班打卡
    #[oai(maximum(value = "9"))]
    pub clockin_flag: u8,
 
    /// 打卡记录的有效状态
    /// - 1: 有效
    /// - 2: 无效
    #[oai(maximum(value = "9"))]
    pub clockin_status: u8,    
    
    /// 考勤日期
    #[oai(max_length = 64)]
    pub attendance_date: String,    

    /// 备注
    #[oai(max_length = 512)]
    pub remarks: Option<String>,

    /// 备注图片
    #[oai(max_length = 512)]
    pub colockin_img: Option<String>,

    



}


#[derive(ApiResponse)]
pub enum ClockInfoResponse {

    #[oai(status = 200)]
    Ok(Json<ClockInfo>),

    #[oai(status = 400)]
    NotFound
}